package com.cropflow.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

@Controller
public class MainController {
    
    // 登录页面
    @GetMapping("/login")
    public String login() {
        return "login";
    }
    
    // 主页Dashboard
    @GetMapping("/dashboard")
    public String dashboard(Model model) {
        // 添加统计数据
        model.addAttribute("onlineVehicles", 12);
        model.addAttribute("todayProgress", 75);
        model.addAttribute("emergencyStops", 0);
        return "dashboard";
    }
    
    // 根路径重定向到dashboard
    @GetMapping("/")
    public String home() {
        return "redirect:/dashboard";
    }
}